package com.example.addressbook;

import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.graphics.Point;
import org.eclipse.ui.IWorkbenchPreferenceConstants;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
import org.eclipse.ui.application.WorkbenchWindowAdvisor;

import com.example.addressbook.ids.AddressBook;

public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {

    public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
        super(configurer);
    }

    public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) {
        return new ApplicationActionBarAdvisor(configurer);
    }
    
    public void preWindowOpen() {
    	IPreferenceStore prefStore = PlatformUI.getPreferenceStore();
    	prefStore.setValue( IWorkbenchPreferenceConstants.PERSPECTIVE_BAR_EXTRAS, AddressBook.PERSPECTIVE_ID_ADDRESS + ", "+AddressBook.PERSPECTIVE_ID_FILEBROWSER);
    	IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
        configurer.setInitialSize(new Point(1400, 800));
        configurer.setShowCoolBar(true);
        configurer.setShowPerspectiveBar( true);
        configurer.setShowStatusLine(true);
        configurer.setShowProgressIndicator(true);
        configurer.setTitle("Adressbuch"); //$NON-NLS-1$
    }
    
}
